package com.woniuxy.caradmin.service.impl;
import com.woniuxy.caradmin.entity.pojo.Apply;
import com.woniuxy.caradmin.mapper.ApplyMapper;
import com.woniuxy.caradmin.service.ApplyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;
/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author womenzu
 * @since 2020-12-07
 */
@Service
public class ApplyServiceImpl implements ApplyService{

    @Autowired
    private ApplyMapper applyMapper;
    @Override
    public Boolean addApply(Apply apply) {
        if (apply!=null){

            apply.setAvailable(2);
            apply.setApplytime(new Date(System.currentTimeMillis()));
            applyMapper.addApply(apply);
            return true;
        }
          return  false;
    }

    @Override
    public List<Apply> selectApply() {
        List<Apply> applyList=applyMapper.selectApply();
        return applyList;
    }

    @Override
    public Apply selectIsApply(Integer uid) {
       Apply apply=applyMapper.selectIsApply(uid);
        return apply;
    }

    @Override
    public Boolean updateApply(Integer uid) {
        if(uid!=null){
      applyMapper.updateApply(uid);
        return true;
        }
        return false;
    }

    @Override
    public Boolean updateApply0(Integer uid) {
        if(uid!=null){
            applyMapper.updateApply0(uid);
            return true;
        }
        return false;
    }
}
